{% extends 'layout.html' %}
{% block content %}
<div class="container">
    <div class="panel panel-success">
        <div class="panel-heading">
            <form class="navbar-form navbar-right" method="get">
                <div class="form-group">
                    <input type="text" class="form-control" name="q" placeholder="搜索包含的数字" value="{{search_data}}">
                </div>
                <button type="submit" class="btn btn-primary">
                    <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                </button>
            </form>
        </div>
        <div class="panel-body">
            <table class="table table-bordered table-hover">
                <caption>最新手机咨询</caption>
                <thead>
                <tr>
                    <th>手机名称</th>
                    <th>上市日期</th>
                    <th>参数</th>
                </tr>
                </thead>
                <tbody>
                {% for phone in new_info %}
                <tr>
                    <th scope="row">{{phone.手机名称}}</th>
                    <td>{{phone.上市日期|date:'Y年m月d日'}}</td>
                    <td>
                        <a href="/phone/info/{{phone.手机名称}}" class="btn btn-primary btn-xs"><span
                                class="glyphicon glyphicon-search" aria-hidden="true"></span></a>
                                {% if request.session.info %}
                        &nbsp;&nbsp;
                        <a href="/phone/{{phone.id}}/edit/" class="btn btn-primary btn-xs"><span
                                class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
                                {% endif %}
                    </td>
                </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>

{% endblock %}